package com.huawei.updatesdk.service.b;

import com.huawei.updatesdk.a.a.b.a.a.a;
import com.huawei.updatesdk.a.b.c.b;
import java.util.ArrayList;
import java.util.List;

public final class c {
    private static c a = new c();
    private static a b = new a() {
        private final List<b> a = new ArrayList();

        public void a(int i, b bVar) {
            synchronized (this.a) {
                for (b a : this.a) {
                    a.a(i, bVar);
                }
            }
        }

        public void a(b bVar) {
            synchronized (this.a) {
                if (bVar == null) {
                    return;
                }
                if (!this.a.contains(bVar)) {
                    try {
                        this.a.add(bVar);
                    } catch (UnsupportedOperationException e) {
                        a.d("InstallObserverManager", "registerObserver UnsupportedOperationException");
                    } catch (ClassCastException e2) {
                        a.d("InstallObserverManager", "registerObserver ClassCastException");
                    } catch (IllegalArgumentException e3) {
                        a.d("InstallObserverManager", "registerObserver IllegalArgumentException");
                    }
                }
            }
        }

        public void b(b bVar) {
            synchronized (this.a) {
                try {
                    this.a.remove(bVar);
                } catch (UnsupportedOperationException e) {
                    a.d("InstallObserverManager", "unRegisterObserver UnsupportedOperationException");
                }
            }
        }
    };

    private c() {
    }

    public static c a() {
        return a;
    }

    public static a b() {
        return b;
    }

    public void a(b bVar) {
        b.a(0, bVar);
    }

    public void b(b bVar) {
        b.a(1, bVar);
    }

    public void c(b bVar) {
        b.a(2, bVar);
    }
}
